package com.kele.dao;

import com.kele.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

public interface UserMapper {

    @Select("select * from user")
    List<User> getUsers();

    //方法存在多个参数，虽有的参数面前都必须加上@Param（）注解
    @Select("select * from user where id = #{id}")
    User getUserByID(@Param("id") int id);

    //添加一个用户
    @Insert("insert into user values (#{id}, #{name}, #{password})")
    int addUser(User user);

    //修改一个用户
    @Update("update user set name=#{name}, pwd=#{password} where id = #{id}")
    int updateUser(User user);

    //删除一个用户
    @Delete("delete from user where id = #{uid}")
    int deleteUser(@Param("uid") int id);
}
